<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
			<link href="../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="../css/together.css" />
		<link rel="stylesheet" type="text/css" href="../css/indexcss.css" />
	</head>
	<body>
		
		
		<div class="hdiv m_barC ">
					<div class="hdivleft mui-icon mui-icon-search"></div>
					<div class="hdivcontent">首页</div>
					<div class="hdivright mui-icon mui-icon-search mui-pull-right search1"></div>
				</div>
				<div class="ws_search">
					<div class="ws_searchIption mui-input-row">
						<input type="search" id="search" class="mui-input-clear" placeholder="">
					</div>
					<span class="ws_searchbtn" id="search_btn">搜索</span>

				</div>
				<div id="slider" class="mui-slider">
					<div class="mui-slider-group mui-slider-loop">
						<div class="mui-slider-item mui-slider-item-duplicate">
							<a href="#">
								<img src="../images/yuantiao.jpg">
							</a>
						</div>
						<div class="mui-slider-item">
							<a href="#">
								<img src="../images/shuijiao.jpg">
							</a>
						</div>
						<div class="mui-slider-item">
							<a href="#">
								<img src="../images/muwu.jpg">
							</a>
						</div>
						<div class="mui-slider-item">
							<a href="#">
								<img src="../images/cbd.jpg">
							</a>
						</div>
						<div class="mui-slider-item">
							<a href="#">
								<img src="../images/yuantiao.jpg">
							</a>
						</div>
						<div class="mui-slider-item mui-slider-item-duplicate">
							<a href="#">
								<img src="../images/shuijiao.jpg">
							</a>
						</div>
					</div>
					<div class="mui-slider-indicator">
						<div class="mui-indicator mui-active"></div>
						<div class="mui-indicator"></div>
						<div class="mui-indicator"></div>
						<div class="mui-indicator"></div>
					</div>
				</div>
				<div class="ws_homeContent">
					<div id="" class="flex3 ws_homeContent_top">
						<span class="recommend flex5">推荐</span>
						<!-- <span class="change flex5">换一换 <i class="mui-icon mui-icon-loop "></i></span> -->
					</div>
					<div class="books_list flex3" id="booklist">

					</div>
				</div>
				
		<script src="../js/jquery.min.js"></script>
		<script src="../js/mui.min.js"></script>
		<script src="../js/mui.enterfocus.js"></script>
		<script src="../js/req.js"></script>
		<script src="../js/util.js"></script>
		<script src="../js/muishow.js" type="text/javascript" charset="utf-8"></script>
		
		<script type="text/javascript">
			window.onload = function(){
				mui.init();
				booklists();
			}
			
			function booklists(name) {
						let data = {
							url: "/api/Book/shop_book_list",
							data: {
								access_token: acctoken() || "",
								search: name || ""
							}
						}
						ajax(data, function(res) {
							console.log("书籍列表",res);
							if(res.code == 1) {
								setbooks(res.data);
							}
						})
					}
				function setbooks(list){
					let str = "";
					if(list.length > 0) {
						list.forEach(function(item,index){
							str += '<div class="books_item" onclick="gohomedet(' + item.id + ')">' +
								'<div class="books_cover ws_100"><img src="' + item.book_image + '" alt="" />' +
								'</div><div class="ws_spdetail"><div>' +
								'</div><span class="ho_books_price">共 <span style="">' +
								item.page_total +
								'</span>页 售价<span style="">' +
								item.price +
								'</span>元</span></div></div></div>';
						})
						
					} else {
						str = '<div class="nobooks">暂无书籍</div>';
					}
					g("booklist").innerHTML = str;
					
				}
			
					function gohomedet(sid) {
						mui.openWindow({
							url: '../home/home_details.html?sid=' + sid,
							id: 'home_details',
							extras: {
								sid: sid
							}
						});
					}
		</script>
	</body>
</html>
